/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.easoftware.code.dao;

import java.io.Serializable;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.inject.Named;
import org.apache.commons.dbutils.QueryRunner;

/**
 *
 * @author EADeveloper
 */
@Named("actividadesDao")
public class ActividadesDao implements Serializable {

    public void registrarAction(String action, String valor, String usuario, Connection c) {
        try {
            QueryRunner run = new QueryRunner();
            StringBuilder sb = new StringBuilder(" insert into logsys(actiondate,action,data_ref,username) values(now(),?,?,?)");
            run.update(c, sb.toString(), action, valor, usuario);
        } catch (SQLException ex) {
            Logger.getLogger(ActividadesDao.class.getName()).log(Level.SEVERE, null, ex);
            System.out.println("NO SE PUDO GUARDAR LA ACTIVIDAD DEL USUARIO");
        } finally {
            if (c != null) {
                try {
                    c.close();
                } catch (SQLException ex) {
                    Logger.getLogger(ActividadesDao.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    }
}
